#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ls o*2
#define rs o*2+1

const int N = 2e5+9;
int n,q;
int a[N], t[N*4], lz[N*4];

void pushup(int o){
    t[o] = t[ls] ^ t[rs];
}

void pushdown(int s, int e, int o){
    if ( lz[o]==0 ) return;

    int mid = (s+e) / 2;
    t[ls] ^= ((mid-s+1)&1) ? lz[o] : 0; 
    t[rs] ^= ((e-mid-1+1)&1) ? lz[o] : 0;
    //1 ^ 0 = 1, 0 ^ 0 = 0
    //1 ^ 1 = 0, 0 ^ 1 = 1

    lz[ls] ^= lz[o];
    lz[rs] ^= lz[o];

    lz[o] = 0;
}

void build(int s=1, int e=n, int o=1){
    if ( s==e ){
        t[o] = a[s];
        return;
    }

    int mid = (s+e) / 2;
    build(s,mid,ls); build(mid+1,e,rs);
    pushup(o);
}

void add(int l, int r, int x, int s=1, int e=n, int o=1){
    if ( l<=s && e<=r ){
        t[o] ^= ((e-s+1)&1) ? x : 0;
        lz[o] ^= x;
        return;
    }

    pushdown(s,e,o);
    int mid = (s+e) / 2;
    if ( l<=mid ) add(l,r,x,s,mid,ls);
    if ( mid+1<=r ) add(l,r,x,mid+1,e,rs);
    pushup(o);
}

int query(int l, int r, int s=1, int e=n, int o=1){
    if ( l<=s && e<=r ){
        return t[o];
    }

    pushdown(s,e,o);
    int mid = (s+e) / 2;
    int res = 0;
    if ( l<=mid ) res ^= query(l,r,s,mid,ls);
    if ( mid+1<=r ) res ^= query(l,r,mid+1,e,rs);
    pushup(o);
    return res;
}

signed main(){
    cin >> n >> q;
    for ( int i=1; i<=n; i++ ) cin >> a[i];
    build();

    while(q--){
        int op; cin >> op;
        if ( op==1 ){
            int l,r,x; cin >> l >> r >> x;
            add(l,r,x);
        } else {
            int l,r; cin >> l >> r;
            cout << query(l,r) << '\n';
        }
    }
}